from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileRequired, FileAllowed
from wtforms import Form,StringField,PasswordField, BooleanField, SubmitField
from wtforms.validators import DataRequired, Length

class LoginForm(Form):
    username = StringField('Username',validators=[DataRequired(message=u'用户名不能为空')],render_kw={'placehoder':'Your Username'})
    password = PasswordField('Password',validators=[DataRequired(),Length(8, 128)])
    remember = BooleanField('Remember me')
    submit = SubmitField('Log in')

class UploadForm(FlaskForm):
    photo = FileField('Upload Image', validators=[FileRequired(), FileAllowed(['png'])])
    submit = SubmitField()





if __name__ == '__main__':
    form = LoginForm()
    form.username()
    print(form.username())